<?php
/**
 * Created by PhpStorm.
 * User: xu42
 * Date: 16-9-7
 * Time: 下午1:24
 */

namespace App\Library;

use EasyWeChat\Foundation\Application;


class News
{
    public static function chunkSendByStaff( $news, $openId )
    {
        $app = new Application( config( 'wechat' ) );

        // 科目超过8项分组发送
        if ( count( $news ) > 7 ) {
            $newss = array_chunk( $news, 8 );
            foreach ( $newss as $news ) {
                $app->staff->message( $news )->to( $openId )->send();
            }
        } else {
            $app->staff->message( $news )->to( $openId )->send();
        }
        return null;
    }
}